﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Random
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using System.Runtime.CompilerServices;
using UnityEngine.Bindings;

#nullable disable
namespace UnityEngine
{
  /// <summary>
  ///   <para>Easily generate random data for games.</para>
  /// </summary>
  [NativeHeader("Runtime/Export/Random/Random.bindings.h")]
  public static class Random
  {
    /// <summary>
    ///   <para>Initializes the random number generator state with a seed.</para>
    /// </summary>
    /// <param name="seed">Seed used to initialize the random number generator.</param>
    [StaticAccessor("GetScriptingRand()", StaticAccessorType.Dot)]
    [NativeMethod("SetSeed")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern void InitState(int seed);

    /// <summary>
    ///   <para>Gets or sets the full internal state of the random number generator.</para>
    /// </summary>
    [StaticAccessor("GetScriptingRand()", StaticAccessorType.Dot)]
    public static Random.State state
    {
      get
      {
        Random.State ret;
        Random.get_state_Injected(out ret);
        return ret;
      }
      set => Random.set_state_Injected(ref value);
    }

    /// <summary>
    ///   <para>Returns a random float within [minInclusive..maxInclusive] (range is inclusive).</para>
    /// </summary>
    /// <param name="minInclusive"></param>
    /// <param name="maxInclusive"></param>
    [FreeFunction]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern float Range(float minInclusive, float maxInclusive);

    /// <summary>
    ///   <para>Return a random int within [minInclusive..maxExclusive) (Read Only).</para>
    /// </summary>
    /// <param name="minInclusive"></param>
    /// <param name="maxExclusive"></param>
    public static int Range(int minInclusive, int maxExclusive)
    {
      return Random.RandomRangeInt(minInclusive, maxExclusive);
    }

    [FreeFunction]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern int RandomRangeInt(int minInclusive, int maxExclusive);

    /// <summary>
    ///   <para>Returns a random float within [0.0..1.0] (range is inclusive) (Read Only).</para>
    /// </summary>
    public static extern float value { [FreeFunction, MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>Returns a random point inside or on a sphere with radius 1.0 (Read Only).</para>
    /// </summary>
    public static Vector3 insideUnitSphere
    {
      [FreeFunction] get
      {
        Vector3 ret;
        Random.get_insideUnitSphere_Injected(out ret);
        return ret;
      }
    }

    [FreeFunction]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void GetRandomUnitCircle(out Vector2 output);

    /// <summary>
    ///   <para>Returns a random point inside or on a circle with radius 1.0 (Read Only).</para>
    /// </summary>
    public static Vector2 insideUnitCircle
    {
      get
      {
        Vector2 output;
        Random.GetRandomUnitCircle(out output);
        return output;
      }
    }

    /// <summary>
    ///   <para>Returns a random point on the surface of a sphere with radius 1.0 (Read Only).</para>
    /// </summary>
    public static Vector3 onUnitSphere
    {
      [FreeFunction] get
      {
        Vector3 ret;
        Random.get_onUnitSphere_Injected(out ret);
        return ret;
      }
    }

    /// <summary>
    ///   <para>Returns a random rotation (Read Only).</para>
    /// </summary>
    public static Quaternion rotation
    {
      [FreeFunction] get
      {
        Quaternion ret;
        Random.get_rotation_Injected(out ret);
        return ret;
      }
    }

    /// <summary>
    ///   <para>Returns a random rotation with uniform distribution (Read Only).</para>
    /// </summary>
    public static Quaternion rotationUniform
    {
      [FreeFunction] get
      {
        Quaternion ret;
        Random.get_rotationUniform_Injected(out ret);
        return ret;
      }
    }

    [StaticAccessor("GetScriptingRand()", StaticAccessorType.Dot)]
    [Obsolete("Deprecated. Use InitState() function or Random.state property instead.")]
    public static extern int seed { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    [Obsolete("Use Random.Range instead")]
    public static float RandomRange(float min, float max) => Random.Range(min, max);

    [Obsolete("Use Random.Range instead")]
    public static int RandomRange(int min, int max) => Random.Range(min, max);

    /// <summary>
    ///   <para>Generates a random color from HSV and alpha ranges.</para>
    /// </summary>
    /// <param name="hueMin">Minimum hue [0..1].</param>
    /// <param name="hueMax">Maximum hue [0..1].</param>
    /// <param name="saturationMin">Minimum saturation [0..1].</param>
    /// <param name="saturationMax">Maximum saturation [0..1].</param>
    /// <param name="valueMin">Minimum value [0..1].</param>
    /// <param name="valueMax">Maximum value [0..1].</param>
    /// <param name="alphaMin">Minimum alpha [0..1].</param>
    /// <param name="alphaMax">Maximum alpha [0..1].</param>
    /// <returns>
    ///   <para>A random color with HSV and alpha values in the (inclusive) input ranges. Values for each component are derived via linear interpolation of value.</para>
    /// </returns>
    public static Color ColorHSV() => Random.ColorHSV(0.0f, 1f, 0.0f, 1f, 0.0f, 1f, 1f, 1f);

    /// <summary>
    ///   <para>Generates a random color from HSV and alpha ranges.</para>
    /// </summary>
    /// <param name="hueMin">Minimum hue [0..1].</param>
    /// <param name="hueMax">Maximum hue [0..1].</param>
    /// <param name="saturationMin">Minimum saturation [0..1].</param>
    /// <param name="saturationMax">Maximum saturation [0..1].</param>
    /// <param name="valueMin">Minimum value [0..1].</param>
    /// <param name="valueMax">Maximum value [0..1].</param>
    /// <param name="alphaMin">Minimum alpha [0..1].</param>
    /// <param name="alphaMax">Maximum alpha [0..1].</param>
    /// <returns>
    ///   <para>A random color with HSV and alpha values in the (inclusive) input ranges. Values for each component are derived via linear interpolation of value.</para>
    /// </returns>
    public static Color ColorHSV(float hueMin, float hueMax)
    {
      return Random.ColorHSV(hueMin, hueMax, 0.0f, 1f, 0.0f, 1f, 1f, 1f);
    }

    /// <summary>
    ///   <para>Generates a random color from HSV and alpha ranges.</para>
    /// </summary>
    /// <param name="hueMin">Minimum hue [0..1].</param>
    /// <param name="hueMax">Maximum hue [0..1].</param>
    /// <param name="saturationMin">Minimum saturation [0..1].</param>
    /// <param name="saturationMax">Maximum saturation [0..1].</param>
    /// <param name="valueMin">Minimum value [0..1].</param>
    /// <param name="valueMax">Maximum value [0..1].</param>
    /// <param name="alphaMin">Minimum alpha [0..1].</param>
    /// <param name="alphaMax">Maximum alpha [0..1].</param>
    /// <returns>
    ///   <para>A random color with HSV and alpha values in the (inclusive) input ranges. Values for each component are derived via linear interpolation of value.</para>
    /// </returns>
    public static Color ColorHSV(
      float hueMin,
      float hueMax,
      float saturationMin,
      float saturationMax)
    {
      return Random.ColorHSV(hueMin, hueMax, saturationMin, saturationMax, 0.0f, 1f, 1f, 1f);
    }

    /// <summary>
    ///   <para>Generates a random color from HSV and alpha ranges.</para>
    /// </summary>
    /// <param name="hueMin">Minimum hue [0..1].</param>
    /// <param name="hueMax">Maximum hue [0..1].</param>
    /// <param name="saturationMin">Minimum saturation [0..1].</param>
    /// <param name="saturationMax">Maximum saturation [0..1].</param>
    /// <param name="valueMin">Minimum value [0..1].</param>
    /// <param name="valueMax">Maximum value [0..1].</param>
    /// <param name="alphaMin">Minimum alpha [0..1].</param>
    /// <param name="alphaMax">Maximum alpha [0..1].</param>
    /// <returns>
    ///   <para>A random color with HSV and alpha values in the (inclusive) input ranges. Values for each component are derived via linear interpolation of value.</para>
    /// </returns>
    public static Color ColorHSV(
      float hueMin,
      float hueMax,
      float saturationMin,
      float saturationMax,
      float valueMin,
      float valueMax)
    {
      return Random.ColorHSV(hueMin, hueMax, saturationMin, saturationMax, valueMin, valueMax, 1f, 1f);
    }

    /// <summary>
    ///   <para>Generates a random color from HSV and alpha ranges.</para>
    /// </summary>
    /// <param name="hueMin">Minimum hue [0..1].</param>
    /// <param name="hueMax">Maximum hue [0..1].</param>
    /// <param name="saturationMin">Minimum saturation [0..1].</param>
    /// <param name="saturationMax">Maximum saturation [0..1].</param>
    /// <param name="valueMin">Minimum value [0..1].</param>
    /// <param name="valueMax">Maximum value [0..1].</param>
    /// <param name="alphaMin">Minimum alpha [0..1].</param>
    /// <param name="alphaMax">Maximum alpha [0..1].</param>
    /// <returns>
    ///   <para>A random color with HSV and alpha values in the (inclusive) input ranges. Values for each component are derived via linear interpolation of value.</para>
    /// </returns>
    public static Color ColorHSV(
      float hueMin,
      float hueMax,
      float saturationMin,
      float saturationMax,
      float valueMin,
      float valueMax,
      float alphaMin,
      float alphaMax)
    {
      return Color.HSVToRGB(Mathf.Lerp(hueMin, hueMax, Random.value), Mathf.Lerp(saturationMin, saturationMax, Random.value), Mathf.Lerp(valueMin, valueMax, Random.value), true) with
      {
        a = Mathf.Lerp(alphaMin, alphaMax, Random.value)
      };
    }

    [SpecialName]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void get_state_Injected(out Random.State ret);

    [SpecialName]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void set_state_Injected(ref Random.State value);

    [SpecialName]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void get_insideUnitSphere_Injected(out Vector3 ret);

    [SpecialName]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void get_onUnitSphere_Injected(out Vector3 ret);

    [SpecialName]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void get_rotation_Injected(out Quaternion ret);

    [SpecialName]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void get_rotationUniform_Injected(out Quaternion ret);

    /// <summary>
    ///   <para>Serializable structure used to hold the full internal state of the random number generator. Additional resources: Random.state.</para>
    /// </summary>
    [Serializable]
    public struct State
    {
      [SerializeField]
      private int s0;
      [SerializeField]
      private int s1;
      [SerializeField]
      private int s2;
      [SerializeField]
      private int s3;
    }
  }
}
